/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucue.ptc.rest;

import edu.ucue.ptc.gco.mdl.Pedido;
import edu.ucue.ptc.gco.ngc.PedidoManager;
import edu.ucue.ptc.gco.ngc.PedidoManagerLocal;
import edu.ucue.ptc.gco.util.AtributoInvalidoException;
import edu.ucue.ptc.gco.util.InsuficienteStockException;
import edu.ucue.ptc.gco.util.PedidoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
 * REST Web Service
 *
 * @author wilo
 */
//@Path("GPedido")
@Path("GPedido/{nombre}/{clave}/{callback}")
@RequestScoped
public class GPedidoResource {

    @Context
    private UriInfo context;

    @Inject
    private PedidoManagerLocal pedidoManager;
    
    @Inject
    private Pedido pedidoP;
    /**
     * Creates a new instance of GPedidoResource
     */
    public GPedidoResource() {
    }

    /**
     * Retrieves representation of an instance of edu.ucue.ptc.rest.GPedidoResource
     * @return an instance of java.lang.String
     */
    @GET
    @Produces("application/json")
    @Named
    public String getJson(@PathParam("callback") String callback,@PathParam("nombre") String user,@PathParam("clave") String pass) {
/*        try {
            //TODO return proper representation object

            pedidoP.setCliente(PedidoD.pedido.getCliente());
            pedidoManager.crear(PedidoD.pedido, user, pass);
            
            PedidoD.pedido=null;
        } catch (AtributoInvalidoException ex) {
            Logger.getLogger(GPedidoResource.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InsuficienteStockException ex) {
            Logger.getLogger(GPedidoResource.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(GPedidoResource.class.getName()).log(Level.SEVERE, null, ex);
        }*/
        return "";
    }

    /**
     * PUT method for updating or creating an instance of GPedidoResource
     * @param content representation for the resource
     * @return an HTTP response with content of the updated or created resource.
     */
    @PUT
    @Consumes("application/json")
    public void putJson(String content) {
    }
}
